Skip to content

feat: add 'unopinionated' config #2715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JoshuaKGoldberg
Copy link

@JoshuaKGoldberg JoshuaKGoldberg commented Aug 7, 2025

Fixes #896.

Adds all rules from recommended to a new unopinionated config, with the exception of rules that add in subjective opinions >1% of users might not want (per my vague guesstimation). This list was generated by looking through #896 & linked issues, then running on my personal repos:

Rule Reason Mentioned
catch-error-name Subjective naming preference #896
consistent-function-scoping Subjective preference; doesn't impact control flow
empty-brace-spaces Formatters also handle this #2634
explicit-length-check Subjective preference; increases character count
filename-case Subjective naming preference #896
no-array-callback-reference Subjective preference; not always cleaner code
no-array-reduce Subjective code structure preference #896
no-await-expression-member Subjective preference; not always cleaner code
no-for-loop Subjective preference; not always optimal
no-nested-ternary Very opinionated; some projects need this #896
no-null Subjective preference some libraries don't work with #896
prefer-export-from Subjective preference; not always less code
prefer-query-selector Subjective preference not relevant to all projects #896
prefer-spread Subjective preference; doesn't impact control flow
prevent-abbreviations Subjective naming preference #896
switch-case-braces Subjective preference; not always cleaner code
template-indent Conflicts with Vitest-style .toMatchInlineSnapshot()

This unopinionated config does include the following rules that were mentioned as being candidates for removal:

Rule Reason Mentioned
no-useless-undefined Legitimate improvement; consistent-return doesn't enforce correctness #2715

I recognize I'm not an expert on this plugin and look forward to learning why some rules should(n't) be on those lists. ☺️

@fisker
Copy link
Collaborator

fisker commented Aug 7, 2025

I don't think "Type safety makes this much less useful" is a good reason to make rule 'opinionated'.

If I understand it correctly. It should only include rules for correctness, there should be only a few rules.

@JoshuaKGoldberg JoshuaKGoldberg force-pushed the config-unopinionated branch 2 times, most recently from 45b069b to b31c759 Compare August 7, 2025 15:47
@fisker
Copy link
Collaborator

fisker commented Aug 7, 2025

Rules like consistent-assert, consistent-empty-array-spread are 'opinionated'.

Strictly speaking, part of no-useless-undefined are 'unopinionated', these examples are very "stupid" as JS code https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-undefined.md#fail

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review August 7, 2025 17:43
@JoshuaKGoldberg
Copy link
Author

Ok I think I adjusted for that?

@sindresorhus sindresorhus requested a review from fisker August 11, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add unopinionated preset
3 participants